<?php
App::uses('AppModel', 'Model');
/**
 * Timesheet Model
 *
 * @property User $User
 */
class Timesheet extends AppModel {

/**
 * Validation rules
 *
 * @var array
 */
    public $validate = array(
        'user_id' => array(
            'notempty' => array(
                'rule' => array('notEmpty'),
            ),
        ),

        'name' => array(
            'notempty' => array(
                'rule' => array('notEmpty'),
            ),
			'letters_numbers'=> array(
                'rule'=> 'alphaNumeric',
                'message'=> 'Only letters and numbers allowed.',
			),
        ),

        'date' => array(
            'date' => array(
                'rule' => array('date'),
            ),
        ),

        'start_time' => array(
            'notempty' => array(
                'rule' => array('notEmpty'),
            ),
        ),

        'end_time' => array(
            'notempty' => array(
                'rule' => array('notEmpty'),
            ),
        ),
		
		'total_no_hrs' => array(
			'notempty' => array(
				'rule' => array ('notEmpty'),
				'message' => 'Please enter in the total number of hours worked.',
			),
		),
    );


    //The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * belongsTo associations
 *
 * @var array
 */
	public $belongsTo = array(
		'User' => array(
			'className' => 'User',
			'foreignKey' => 'user_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
}
